//
//  EquipmentCollectionViewCell.m
//  LOL_PalmarHelper
//
//  Created by dllo on 15/6/19.
//  Copyright (c) 2015年 hantao. All rights reserved.
//

#import "EquipmentCollectionViewCell.h"

@implementation EquipmentCollectionViewCell


-(instancetype)initWithFrame:(CGRect)frame
{
    
    self = [super initWithFrame:frame];
    
    if (self) {
        [self createSubViews];
    }
    
    return self;
}


-(void)dealloc
{
       [_myImageView release];
    [_myLabel release];
    [super dealloc];
    
}


-(void)createSubViews
{
    
    self.myImageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, self.contentView.frame.size.width, self.contentView.frame.size.height - 25)];
    self.myImageView.backgroundColor = [UIColor whiteColor];
    [self.contentView addSubview:self.myImageView];
    [_myImageView release];
    
    self.myLabel = [[UILabel alloc] initWithFrame:CGRectMake(self.myImageView.frame.origin.x, self.myImageView.frame.origin.y + self.myImageView.frame.size.height, self.myImageView.frame.size.width, 25)];
    self.myLabel.backgroundColor = [UIColor clearColor];
    self.myLabel.text = @"titel";
    self.myLabel.textAlignment = NSTextAlignmentCenter;
    self.myLabel.font = [UIFont systemFontOfSize:15];
    self.myLabel.numberOfLines = 0;
    self.myLabel.textColor = [UIColor blackColor];
    [self.contentView addSubview:self.myLabel];
    [_myLabel release];
    
}


-(void)setEquopment:(EquipmentModel *)equopment
{

    if (_equopment != equopment) {
        
        [_equopment release];
        _equopment = [equopment retain];
        
        
    }

    
    self.myLabel.text = self.equopment.text;
    
    self.myLabel.lineBreakMode = NSLineBreakByWordWrapping;

    [self.myImageView sd_setImageWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"http://img.lolbox.duowan.com/zb/%@_64x64.png",self.equopment.equipentId]] placeholderImage:[UIImage imageNamed:@"picholder@2x.png"]];
    
    


}




@end
